const api = require('../index')

module.exports = {
  list: () => api.get('/task/list'),

  add: (amount, desc, repeat_times, start_time) => api.post('/task/add', { amount, desc, repeat_times, start_time }),

  watchList: () => api.get('/task/watchedList', { type: 0 }),

  detail: (task_id) => api.get('/task/info', { task_id }),

  upload: (photo) => api.post(`/task/daily/upload`, { photo }),

  praiseTask: (task_daily_id, completion_state, comment) => api.post('/praiseTask', { task_daily_id, completion_state, comment }),

  dailyList: (task_id) => api.get(`/task/daily/list/${task_id}`),

  joinTask: (task_id) => api.post('/joinTask', { task_id }),

  batchToken: (photo, type = 'image') => {
    return api.post('/task/daily/upload', { photo, type })
  }
}